package br.com.devteam.base.util;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

public class Message {

	public static void e(String componentId, String errorMessage) {
		FacesContext.getCurrentInstance()
				.addMessage(
						componentId,
						new FacesMessage(FacesMessage.SEVERITY_ERROR, "",
								errorMessage));
	}

	public static void i(String componentId, String message) {
		FacesContext.getCurrentInstance().addMessage(componentId,
				new FacesMessage(FacesMessage.SEVERITY_INFO, "", message));
	}

	public static void manterMensagensRedirect() {
		FacesContext.getCurrentInstance().getExternalContext().getFlash()
				.setKeepMessages(true);
	}
}
